/*
 * Copyright (c) 2020 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package me.yokeyword.fragmentation.extensions;

import ohos.aafwk.ability.fraction.Fraction;
import ohos.utils.PacMap;

/*
 * Wrapper support setArguments and BackStack record
 * */

public class FractionEx {
    Fraction fraction;
    String tag;
    Boolean hide;
    PacMap bundle = new PacMap();
    Boolean active = false;

    public Boolean getActive() {
        return active;
    }

    public void setActive(Boolean active) {
        this.active = active;
    }

    public String getTag() {
        return tag;
    }

    public FractionEx setTag(String tag) {
        this.tag = tag;
        return this;
    }

    public FractionEx(Fraction fraction) {
        this.fraction = fraction;
    }

    public FractionEx(Fraction fraction, String tag) {
        this.fraction = fraction;
        this.tag = tag;
    }

    public Fraction getFraction() {
        return fraction;
    }

    public void setHide() {
        hide = true;
    }

    public void setUnHide() {
        hide = false;
    }

    public boolean isHide() {
        return hide;
    }

    public void setArguments(PacMap bundle) {
        if (this.bundle != bundle && bundle != null) {
            this.bundle.putAll(bundle);
        }
    }

    public PacMap getArguments() {
        return bundle;
    }
}
